package com.lanyou.esb.cook.proxy.service.push.impl;

import com.lanyou.esb.cook.proxy.entity.PfThroughput;
import com.lanyou.esb.cook.proxy.redis.proxy.impl.PfThroughputJedisProxy;
import com.lanyou.esb.cook.proxy.redis.proxy.impl.PfThroughputKeysJedisProxy;
import com.lanyou.esb.cook.proxy.service.push.Push;

/**
 * 平台吞吐量消息推送服务
 * 
 * @author Davey.wu
 */
public class PfThroughputPushImpl extends BasePush<PfThroughput> implements
		Push<PfThroughput> {

	/** 平台吞吐量REDIS操作代理 **/
	private PfThroughputJedisProxy pfThroughputJedisProxy;
	/** 平台吞吐量键值,REDIS处理器 **/
	private PfThroughputKeysJedisProxy pfThroughputKeysJedisProxy;

	@Override
	public void pushToRedis(PfThroughput pfThroughput) throws Exception {
		if (pfThroughput == null) {
			return;
		}
		String key = pfThroughputJedisProxy.getKeyFromObject(pfThroughput);
		// 保存吞吐量键值
		pfThroughputKeysJedisProxy.saddAsStr(
				pfThroughputKeysJedisProxy.getKey(), key);
		// 保存吞吐量
		pfThroughputJedisProxy.setex(key, pfThroughput);
	}

	public PfThroughputJedisProxy getPfThroughputJedisProxy() {
		return pfThroughputJedisProxy;
	}

	public void setPfThroughputJedisProxy(
			PfThroughputJedisProxy pfThroughputJedisProxy) {
		this.pfThroughputJedisProxy = pfThroughputJedisProxy;
	}

	public PfThroughputKeysJedisProxy getPfThroughputKeysJedisProxy() {
		return pfThroughputKeysJedisProxy;
	}

	public void setPfThroughputKeysJedisProxy(
			PfThroughputKeysJedisProxy pfThroughputKeysJedisProxy) {
		this.pfThroughputKeysJedisProxy = pfThroughputKeysJedisProxy;
	}
	
}
